import types  from './types';
import moment from 'moment';

const { SPECIFICDATE, TODAYDATE } = types;

export default {
  toViewData: ({ defaultValue, defaultValueType }) => {
    let value = '';

    switch(defaultValueType) {
      case SPECIFICDATE:
        value = defaultValue;
        break;
      case TODAYDATE:
        value = moment().format('YYYY-MM-DD');
        break;
    }    

    return { 
      defaultValue: value
    };
  }
}